﻿<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ taglib prefix="s" uri="http://shiro.apache.org/tags" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fns" uri="/WEB-INF/tlds/fns.tld" %>
<%@ include file="/WEB-INF/view/include/inc.jsp"%>
<!DOCTYPE html>
<html lang="en">
<head>
 	<%@ include file="/WEB-INF/view/jQgrid.jsp"%>
</head>
<body>
<div class="container-fluid" id="main-container">
    <div id="page-content" class="clearfix">
        <div class="row-fluid">
                <div class="ibox-content">
                    <form class="form-horizontal m-t form-inline" id="signupForm" method="post" enctype="multipart/form-data">
                        <input type="hidden" name="contactId" id="contactId" value="${contact.contactId }"/>
                        <input type="hidden" name="companyId" id="companyId" value="${contact.companyId }"/>
						<div class="form-group">
							<label class="col-sm-2 control-label">姓名：</label>
							<div class="col-sm-4">
								<input type="text" class="form-control" id="trueName" name="trueName" value="${contact.resume.trueName }"/>
							</div>
							<label class="col-sm-2 control-label">联系电话：</label>
							<div class="col-sm-4">
								<input type="text" class="form-control" id="cellphone" name="cellphone" value="${contact.resume.cellphone }"/>
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-2 control-label">微信：</label>
							<div class="col-sm-4">
								<input type="text" class="form-control" id="wechat" name="wechat" value="${contact.resume.wechat }"/>
							</div>
							<label class="col-sm-2 control-label">QQ：</label>
							<div class="col-sm-4 form-inline">
								<input type="text" class="form-control" id="qq" name="qq" value="${contact.resume.qq }"/>
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-2 control-label">邮箱：</label>
							<div class="col-sm-4">
								<input type="text" class="form-control" id="email" name="email" onblur="isEmail('email',this.value)" value="${contact.resume.email }"/>
							</div>
							<label class="col-sm-2 control-label">公司职位：</label>
							<div class="col-sm-4">
								<input type="text" class="form-control" id="position" name="position" value="${contact.position }"/>
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-2 control-label">在岗状态：</label>
							<div class="col-sm-4">
								<select class="form-control" id="status" name="status">
								<option value="">==请选择==</option>
								<option value="1" <c:if test="${contact.status eq 1 }">selected</c:if>>==在岗==</option>
								<option value="2" <c:if test="${contact.status eq 2 }">selected</c:if>>==离岗==</option>
								</select>
							</div>
						</div>
						<div class="form-group" style="text-align: center;">
							<div class="col-sm-8 col-sm-offset-3">
								<button class="btn btn-primary" type="button" id="sub">提交</button>
							</div>
						</div>
					</form>
                </div>
                <!-- tableover -->
            </div>
            <!-- PAGE CONTENT ENDS HERE -->

        </div>
        <!--/row-->
    </div>
    <!--/#page-content-->
</div>
<!--/.fluid-container#main-container-->
<script type="text/javascript">
    $(function(){
    	$("#sub").click(function () {
        	//调用方式
        	var arr=new Array(
        	  new Array('trueName','姓名未填写!'),
        	  new Array('cellphone','手机号码未填写!'),
        	  new Array('wechat','微信未填写!'),
        	  new Array('qq','QQ未填写!'),
        	  new Array('email','邮箱未填写!'),
        	  new Array('postion','公司职位未填写!')
        	);
        	//批量验证表单非空
        	  for(var i=0;i<arr.length;i++){
	        	  if($("#"+arr[i][0]).val()==''){
	        		  $("#"+arr[i][0]).tips({
	  					side:3,
	  		            msg:arr[i][1],
	  		            bg:'#AE81FF',
	  		            time:1
	  		        });
	        		  $("#"+arr[i][0]).focus();
	  				return;
	  			}
        	  };
            $("#signupForm").ajaxSubmit({
                url: '<%=contextPath%>/company/editContact',
					type : 'post',
					dataType : "json",
					beforeSend: function () {
				        // 禁用按钮防止重复提交
						$("#sub").attr("disabled","disabled");
						swal("信息已经提交，请等待后台处理~！");
				    },
					success : function(data) {
						if (data.code == 200) {
							swal({
								title : data.message,
								type : "success",
								showCancelButton : false,
								confirmButtonText : "确定",
								animation : "slide-from-bottom",
								closeOnConfirm : true
							}, function() {
								top.Dialog.close();
							});
						} else {
							swal("错误", data.message, "error");
						}
					},
					complete: function () {
				        $("#sub").removeAttr("disabled");
				    },
				    error: function (data) {
				    	swal("错误", data.message, "error");
				    }
				});

			});
    })
</script>
</body>
</html>

